// nodeman  好像可以自动刷新

const Koa = require('koa');    // koa是web开发框架
const axios = require('axios')
const Router = require('koa-router')
const error = require('./middleware/error')
// 实例化应用程序
const app = new  Koa();
const router = new Router();

app.use(error);
router.get('/page',async ctx=>{
    await axios.get('http"//www.taobao.com1')
})

router.get('/user',ctx=>{
    throw new Error('出错了')
})

// 洋葱模型 
app.use(router.routes())
app.listen(3000);